package com.jzqf.harmonydemo.utils;

import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

/**
 * 日志工具类
 *
 * @author LiuWeiHao
 * 2021/5/19 16:58
 */
public class LogUtil {
    private static final HiLogLabel LABEL_LOG = new HiLogLabel(HiLog.LOG_APP, 0, "harmonylog");
    private static final String LOG_FORMAT = "%{public}s: %{public}s";

    public static void d(String tag, String message) {
        //TODO 日志有时候不显示
        HiLog.info(LABEL_LOG, LOG_FORMAT, tag, "---" + message);
        System.out.println(tag + "---" + message);
    }

    public static void i(String tag, String message) {
        HiLog.info(LABEL_LOG, LOG_FORMAT, tag, message);
        System.out.println(tag + "---" + message);
    }

    public static void e(String tag, String message) {
        HiLog.error(LABEL_LOG, LOG_FORMAT, tag, message);
        System.out.println(tag + "---" + message);
    }
}
